package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Flight;
import cn.wolfcode.luowowo.article.mapper.FlightMapper;
import cn.wolfcode.luowowo.article.query.AirTicketQuery;
import cn.wolfcode.luowowo.article.service.IFlightService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class FlightServiceImpl implements IFlightService {

    @Autowired
    private FlightMapper flightMapper;

    @Override
    public PageInfo query(AirTicketQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Flight> list = flightMapper.queryForList(qo);
        return new PageInfo(list);
    }

    @Override
    public Flight get(Long id) {
        Flight flight = flightMapper.get(id);
        return flight;
    }

    @Override
    public List<Flight> querySome(AirTicketQuery qo) {
        List<Flight> list = flightMapper.querySome(qo);
        return list;
    }
}
